package com.own.component.autoconfig.property.redis;

import lombok.Data;
import org.springframework.boot.SpringBootConfiguration;
import org.springframework.boot.context.properties.ConfigurationProperties;

import java.time.Duration;

/**
 * RedisProperties
 *
 * @author chenxueli
 * @date 2022-08-10 14:37:00
 */
@Data
@SpringBootConfiguration
@ConfigurationProperties(prefix = "spring.redis")
public class RedisProperties {

    private Boolean enabled = false;

    /**
     * Database index used by the connection factory.
     */
    private int database = 0;

    /**
     * Connection URL. Overrides host, port, username, and password. Example:
     * redis://user:password@example.com:6379
     */
    private String url;

    /**
     * Redis server host.
     */
    private String host = "localhost";

    /**
     * Login username of the redis server.
     */
    private String username;

    /**
     * Login password of the redis server.
     */
    private String password;

    /**
     * Redis server port.
     */
    private int port = 6379;

    /**
     * Whether to enable SSL support.
     */
    private boolean ssl;

    /**
     * Read timeout.
     */
    private Duration timeout;

    /**
     * Connection timeout.
     */
    private Duration connectTimeout;

    /**
     * Client name to be set on connections with CLIENT SETNAME.
     */
    private String clientName;

    /**
     * Type of client to use. By default, auto-detected according to the classpath.
     */
    private org.springframework.boot.autoconfigure.data.redis.RedisProperties.ClientType clientType;

    private org.springframework.boot.autoconfigure.data.redis.RedisProperties.Sentinel sentinel;

    private org.springframework.boot.autoconfigure.data.redis.RedisProperties.Cluster cluster;

}
